package beer.coder.walawala.common.config;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * 分类配置
 *
 * @author amath0312
 * @version 1.0
 * @date 2019-10-24 20:54
 */
public class TabConfigure {

  public static final String DEFALT_NAME = "新建分类";
  public static final String DEFAULT_TAB_SELECTED_STYLE = "-fx-background-color: #CCCCCC;-fx-padding: 4;-fx-alignment: CENTER;-fx-border-color: brown;-fx-border-style: dashed;-fx-border-width: 2;-fx-border-radius: 5;";
  public static final String DEFAULT_TAB_STYLE = "-fx-background-color: #CCCCCC;-fx-padding: 4;-fx-alignment: CENTER;";
  public static final String DEFAULT_CONTENT_STYLE = "-fx-background-color: #B9D3EE; -fx-padding: 4;-fx-alignment: TOP-LEFT;";

  String name;
  String tabSelectedStyle;
  String tabStyle;
  String contentStyle;
  List<ItemConfigure> items;

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getTabSelectedStyle() {
    return tabSelectedStyle;
  }

  public void setTabSelectedStyle(String tabSelectedStyle) {
    this.tabSelectedStyle = tabSelectedStyle;
  }

  public String getTabStyle() {
    return tabStyle;
  }

  public void setTabStyle(String tabStyle) {
    this.tabStyle = tabStyle;
  }

  public String getContentStyle() {
    return contentStyle;
  }

  public void setContentStyle(String contentStyle) {
    this.contentStyle = contentStyle;
  }

  public ItemConfigure[] getItems() {
    if (this.items == null) {
      return new ItemConfigure[0];
    } else {
      return items.toArray(new ItemConfigure[0]);
    }
  }

  public void setItems(ItemConfigure[] items) {
    this.items = new LinkedList<ItemConfigure>();
    Collections.addAll(this.items, items);
  }

  public void addItem(ItemConfigure item) {
    if (this.items == null) {
      this.items = new LinkedList<>();
    }
    this.items.add(item);
  }

  public void remoteItem(ItemConfigure item) {
    if (this.items == null) {
      this.items = new LinkedList<>();
    }
    if (this.items.contains(item)) {
      this.items.remove(item);
    }
  }
}
